home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / Technical Documentation / Macintosh Technotes and Q&As / technotes / tn / Apple_Guide_Variables / Guide source / Content next >
Encoding:
Text File  |  1997-12-10  |  11.1 KB  |  429 lines  |  [TEXT/R*ch]

  1.  
  2. ######################################################################
  3. #  Access Window Content
  4. ######################################################################
  5.  
  6. <Topic Area> "GX screen Dump"
  7.  
  8.   <Header> "Tutorial"
  9.  
  10.     <Topic> "From Start",              "Tutorial From Start"
  11.     <Topic> "Skip completed lessons",  "Tutorial Skip lessons"
  12.     <Topic> "Lesson 1",                "Lesson 1"
  13.     <Topic> "Lesson 2",                "Lesson 2"
  14.     <Topic> "Lesson 3",                "Lesson 3"
  15.  
  16.   <Header> "House keeping"
  17.  
  18.     <Topic> "Reset the Lesson plan",       "Reset the Lesson plan"
  19.     <Topic> "Display Lesson plan Status",  "What is the Lesson Status?"
  20.  
  21.  
  22. ######################################################################
  23. #  Tutorial From Start Sequence & Panel
  24. #
  25. #  This sequence puts up an intro panel then steps through each lesson
  26. #  in turn. The first panel uses the "StartHelperApp" script to
  27. #  launch the helper app. It then clears all the values.
  28. #
  29. ######################################################################
  30.  
  31. <Define Sequence> "Tutorial From Start", "Tutorial"
  32.   <Panel> "Tutorial From Start - Intro"
  33.  
  34.   <Jump Sequence> "Lesson 1"
  35.   
  36.   <Jump Sequence> "Lesson 2"
  37.   
  38.   <Jump Sequence> "Lesson 3"
  39.   
  40.   <Panel> "Tutorial Outro"
  41. <End Sequence>
  42.  
  43.  
  44. <Define Panel> "Tutorial From Start - Intro"
  45.   <On Panel Create> DoAppleScript( "StartHelperApp" )
  46.   <On Panel Create> ClearValues()
  47. This is the first panel in the tutorial.
  48. It launches the helper App, then clears the values.
  49. <End Panel>
  50.  
  51. ######################################################################
  52. #  Tutorial Skip lessons - Sequence & Panel
  53. #
  54. #  This sequence puts up an intro panel then steps through each lesson
  55. #  in turn which hasn't been completed. The first panel uses the
  56. #  "StartHelperApp" script to launch the helper app.
  57. #
  58. ######################################################################
  59.  
  60. <Define Sequence> "Tutorial Skip lessons", "Tutorial"
  61.   <Panel> "Tutorial Intro"
  62.  
  63.   <If> NOT Flag1Set()
  64.     <Jump Sequence> "Lesson 1"
  65.   <End If>
  66.   
  67.   <If> NOT Flag2Set()
  68.     <Jump Sequence> "Lesson 2"
  69.   <End If>
  70.  
  71.   <If> NOT Flag3Set()
  72.     <Jump Sequence> "Lesson 3"
  73.   <End If>
  74.  
  75.   <Panel> "Tutorial Outro"
  76. <End Sequence>
  77.  
  78. <Define Panel> "Tutorial Intro"
  79. <On Panel Create> DoAppleScript( "StartHelperApp" )
  80. This is the first panel in the tutorial.
  81. It launches the helper App.
  82. <End Panel>
  83.  
  84. <Define Panel> "Tutorial Outro"
  85. You have now completed all the tutorial.
  86. <End Panel>
  87.  
  88. ######################################################################
  89. #  Lesson Sequences & Panels
  90. #
  91. #  These do not really do much but serve as examples of how to mark
  92. #  Sequences as completed. The first panel use "StartHelperApp" to
  93. #  make sure the helper app is up and running. The final panel uses 
  94. #  <On Panel Hide> SetFlag1() to mark that a lesson has been 
  95. #  finished.
  96. #
  97. ######################################################################
  98.  
  99. #---------------------------------------------------------------------
  100. #  Lesson 1 Sequence & Panels
  101. #---------------------------------------------------------------------
  102.  
  103. <Define Sequence> "Lesson 1", "Lesson 1"
  104.       <Panel> "Lesson 1 Panel 1"
  105.       <Panel> "Lesson 1 Panel 2"
  106.       <Panel> "Lesson 1 Panel Outro"
  107. <End Sequence>
  108.  
  109. <Define Panel> "Lesson 1 Panel 1"
  110. <On Panel Create> DoAppleScript( "StartHelperApp" )
  111. First panel in Lesson 1
  112.  
  113. This could contain your lesson's introduction.
  114.  
  115. It also uses a script to make sure the helper app is open :
  116. "<On Panel Create> DoAppleScript( "StartHelperApp" )"
  117. <End Panel>
  118.  
  119.  
  120. <Define Panel> "Lesson 1 Panel 2"
  121. Second panel onwards...
  122.  
  123. These contain your lesson's text.
  124. <End Panel>
  125.  
  126.  
  127. <Define Panel> "Lesson 1 Panel Outro"
  128.   <On Panel Hide> SetFlag1()
  129. Last panel in Lesson 1.
  130.  
  131. This may contain an acknowledgment that the lesson has been completed.
  132.  
  133. It sets flag 1 with :
  134. "<On Panel Hide> SetFlag1()"
  135. <End Panel>
  136.  
  137. #---------------------------------------------------------------------
  138. #  Lesson 2 Sequence & Panels
  139. #---------------------------------------------------------------------
  140.  
  141. <Define Sequence> "Lesson 2", "Lesson 2"
  142.       <Panel> "Lesson 2 Panel 1"
  143.       <Panel> "Lesson 2 Panel 2"
  144.       <Panel> "Lesson 2 Panel Outro"
  145. <End Sequence>
  146.  
  147. <Define Panel> "Lesson 2 Panel 1"
  148. <On Panel Create> DoAppleScript( "StartHelperApp" )
  149. First panel in Lesson 2 
  150.  
  151. This could contain your lesson's introduction.
  152.  
  153. It also uses a script to make sure the helper app is open :
  154. "<On Panel Create> DoAppleScript( "StartHelperApp" )"
  155. <End Panel>
  156.  
  157.  
  158. <Define Panel> "Lesson 2 Panel 2"
  159. Second panel onwards...
  160.  
  161. These contain your lesson text.
  162. <End Panel>
  163.  
  164.  
  165. <Define Panel> "Lesson 2 Panel Outro"
  166.   <On Panel Hide> SetFlag2()
  167. Last panel in Lesson 2 
  168.  
  169. This may contain an acknowledgment that the lesson has been completed.
  170.  
  171. It sets flag 2 with :
  172. "<On Panel Hide> SetFlag2()"
  173. <End Panel>
  174.  
  175. #---------------------------------------------------------------------
  176. #  Lesson 3 Sequence & Panels
  177. #---------------------------------------------------------------------
  178.  
  179. <Define Sequence> "Lesson 3", "Lesson 3"
  180.       <Panel> "Lesson 3 Panel 1"
  181.       <Panel> "Lesson 3 Panel 2"
  182.       <Panel> "Lesson 3 Panel Outro"
  183. <End Sequence>
  184.  
  185. <Define Panel> "Lesson 3 Panel 1"
  186. <On Panel Create> DoAppleScript( "StartHelperApp" )
  187. First panel in Lesson 3 
  188.  
  189. This could contain your lesson's introduction.
  190.  
  191. It also uses a script to make sure the helper app is open :
  192. "<On Panel Create> DoAppleScript( "StartHelperApp" )"
  193. <End Panel>
  194.  
  195.  
  196. <Define Panel> "Lesson 3 Panel 2"
  197. Second panel onwards...
  198.  
  199. These contain your lesson text.
  200. <End Panel>
  201.  
  202.  
  203. <Define Panel> "Lesson 3 Panel Outro"
  204.   <On Panel Hide> SetFlag3()
  205. Last panel in Lesson 3 
  206.  
  207. This may contain an acknowledgment that the lesson has been completed.
  208.  
  209. It sets flag 3 with :
  210. "<On Panel Hide> SetFlag3()"
  211. <End Panel>
  212.  
  213.  
  214. ######################################################################
  215. #  Reset the Lesson plan
  216. #
  217. # This is a one panel sequence that uses ClearValues() event to 
  218. # set all the flags for the lesson plan to 0 i.e. not completed.
  219. ######################################################################
  220.  
  221. <Define Sequence> "Reset the Lesson plan", "Reset the Lesson plan"
  222. <Seq Nav Button Set> NONE
  223.   <Panel> "Values Cleared"
  224. <End Sequence>
  225.  
  226.  
  227. <Define Panel> "Values Cleared"
  228.   <On Panel Create> ClearValues()
  229.   
  230. Lesson plan reset
  231.  
  232. <3D Button> 1070, 1072, Center, GoStart()
  233.  
  234. <End Panel>
  235.  
  236.  
  237. ######################################################################
  238. #  What is the Lesson Status?
  239. #
  240. # This sequence display what the current status of the flags are. It
  241. # uses the context checks Flag'n'Set() to work out which panel to
  242. # display. As there are 3 flags, there are 8 combinations, therefore
  243. # there are 8 different panels. The sequence arbitrates which to
  244. # display.
  245. ######################################################################
  246.  
  247. <Define Sequence> "What is the Lesson Status?", "What is the Lesson Status?"
  248. <Seq Nav Button Set> NONE
  249.     <IF> Flag1Set() AND Flag2Set() AND Flag3Set()
  250.       <Panel> "On On On"
  251.     <END IF>
  252.     
  253.     <IF> Flag1Set() AND Flag2Set() AND (NOT Flag3Set())
  254.       <Panel> "On On Off"
  255.     <END IF>
  256.     
  257.     <IF> Flag1Set() AND (NOT Flag2Set()) AND Flag3Set()
  258.       <Panel> "On Off On"
  259.     <END IF>
  260.     
  261.     <IF> Flag1Set() AND (NOT Flag2Set()) AND (NOT Flag3Set())
  262.       <Panel> "On Off Off"
  263.     <END IF>
  264.     
  265.     <IF> (NOT Flag1Set()) AND Flag2Set() AND Flag3Set()
  266.       <Panel> "Off On On"
  267.     <END IF>
  268.     
  269.     <IF> (NOT Flag1Set()) AND Flag2Set() AND (NOT Flag3Set())
  270.       <Panel> "Off On Off"
  271.     <END IF>
  272.     
  273.     <IF> (NOT Flag1Set()) AND (NOT Flag2Set()) AND Flag3Set()
  274.       <Panel> "Off Off On"
  275.     <END IF>
  276.     
  277.     <IF> (NOT Flag1Set()) AND (NOT Flag2Set()) AND (NOT Flag3Set())
  278.       <Panel> "Off Off Off"
  279.     <END IF>
  280. <End Sequence>
  281.  
  282.  
  283. <Define Panel> "Off Off Off"
  284.  
  285. Lesson 1   -  Not Completed
  286. Lesson 2   -  Not Completed
  287. Lesson 3   -  Not Completed
  288.  
  289. <3D Button> 1070, 1072, Center, GoStart()
  290.  
  291. <End Panel>
  292.  
  293. <Define Panel> "Off Off On"
  294.  
  295. Lesson 1   -  Not Completed
  296. Lesson 2   -  Not Completed
  297. Lesson 3   -  Completed
  298.  
  299. <3D Button> 1070, 1072, Center, GoStart()
  300.  
  301. <End Panel>
  302.  
  303. <Define Panel> "Off On Off"
  304.  
  305. Lesson 1   -  Not Completed
  306. Lesson 2   -  Completed
  307. Lesson 3   -  Not Completed
  308.  
  309. <3D Button> 1070, 1072, Center, GoStart()
  310.  
  311. <End Panel>
  312.  
  313. <Define Panel> "Off On On"
  314.  
  315. Lesson 1   -  Not Completed
  316. Lesson 2   -  Completed
  317. Lesson 3   -  Completed
  318.  
  319. <3D Button> 1070, 1072, Center, GoStart()
  320.  
  321. <End Panel>
  322.  
  323. <Define Panel> "On Off Off"
  324.  
  325. Lesson 1   -  Completed
  326. Lesson 2   -  Not Completed
  327. Lesson 3   -  Not Completed
  328.  
  329. <3D Button> 1070, 1072, Center, GoStart()
  330.  
  331. <End Panel>
  332.  
  333. <Define Panel> "On Off On"
  334.  
  335. Lesson 1   -  Completed
  336. Lesson 2   -  Not Completed
  337. Lesson 3   -  Completed
  338.  
  339. <3D Button> 1070, 1072, Center, GoStart()
  340.  
  341. <End Panel>
  342.  
  343. <Define Panel> "On On Off"
  344.  
  345. Lesson 1   -  Completed
  346. Lesson 2   -  Completed
  347. Lesson 3   -  Not Completed
  348.  
  349. <3D Button> 1070, 1072, Center, GoStart()
  350.  
  351. <End Panel>
  352.  
  353. <Define Panel> "On On On"
  354.  
  355. Lesson 1   -  Completed
  356. Lesson 2   -  Completed
  357. Lesson 3   -  Completed
  358.  
  359. <3D Button> 1070, 1072, Center, GoStart()
  360.  
  361. <End Panel>
  362.  
  363.  
  364.  
  365.  
  366. ######################################################################
  367. # Define Context Checks
  368. #
  369. # <DCC> Name, context ID, Application ID, additional parameters...
  370. # Additional parameters have a type, e.g. LONG. This parameter needs to
  371. # be entered unless it has a :Constant after it, e.g LONG:1
  372. #
  373. # For Example:
  374. # <DCC> "IsFlagSet", 'Vals', 'AgHp', LONG:1, LONG
  375. #   "IsFlagSet" - the context checks name
  376. #   'Vals'      - the context ID Passed to the application
  377. #   'AgHp'      - the application that the check is querying
  378. #
  379. # it has 2 additional parameters
  380. #    LONG:1 - first parameter is a long and defaults to 1 therefore it
  381. #             doesn't need to be enetered
  382. #    LONG   - second parameter is also a long but needs to be entered.
  383. #
  384. # To use the check you need make a call such as
  385. #   IsFlagSet(3)
  386. # As the first parameter is defaulted to 1, 3 will be put into the
  387. # second parameter
  388. #
  389. # The structure passed to the applications context check should look like:
  390. #    struct PassedAGParamType
  391. #    {
  392. #      long additionalParameter1;
  393. #      long additionalParameter2;
  394. #    };
  395. #
  396. #
  397. # IsFlagSet( n )   - Checks application constant n is set
  398. # IsFlagClear( n ) - Checks application constant n is clear
  399. # Flag1Set()       - Checks application constant 1 is set
  400. # Flag2Set()       - Checks application constant 2 is set
  401. # Flag3Set()       - Checks application constant 3 is set
  402. ######################################################################
  403.  
  404. <DCC> "IsFlagSet",    'Vals', 'AgHp', LONG:1, LONG
  405. <DCC> "IsFlagClear",  'Vals', 'AgHp', LONG:0, LONG
  406.  
  407. <DCC> "Flag1Set",     'Vals', 'AgHp', LONG:1, LONG:1
  408. <DCC> "Flag2Set",     'Vals', 'AgHp', LONG:1, LONG:2
  409. <DCC> "Flag3Set",     'Vals', 'AgHp', LONG:1, LONG:3
  410.  
  411.  
  412. ######################################################################
  413. # Define Events
  414. #
  415. # The following events set or clear 1 or all of the flags
  416. ######################################################################
  417.  
  418. <Define Event> "ClearValues", 'AgHp', 'Vals', 'Cler'
  419.  
  420. <Define Event> "SetFlag1",   'AgHp', 'Vals', 'Set1'
  421. <Define Event> "SetFlag2",   'AgHp', 'Vals', 'Set2'
  422. <Define Event> "SetFlag3",   'AgHp', 'Vals', 'Set3'
  423.  
  424. <Define Event> "ClearFlag1", 'AgHp', 'Vals', 'Clr1'
  425. <Define Event> "ClearFlag2", 'AgHp', 'Vals', 'Clr2'
  426. <Define Event> "ClearFlag3", 'AgHp', 'Vals', 'Clr3'
  427.  
  428.